﻿
        $(function() {
            var id = "SlideShow";
            var arr = $("#" + id + " img");
            var current = $("#" + id + " img:first-child");
            var i = 0;
            var duration = 2000;
            $("#" + id + " img").hide(); // ?n t?t c? các th? img trong l?p có id là SlideShow
            //   slide show
            function slideShow(current) {
                current.fadeIn(duration, function() {
                    $(this).fadeOut(duration, function() {
                        ++i;
                        if (i == arr.length) {
                            i = 0;
                            current = $("#" + id + " img:first-child");
                            slideShow(current);
                        }
                        else {
                            slideShow(current.next());
                        }
                    });
                });
            }
            slideShow(current);
        });
